package com.sunda.spmsweb.overseacontroller;


import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 海外仓收货装箱单表 前端控制器
 * </p>
 *
 * @author Wayne
 * @since 2021-08-17
 */
@RestController
@RequestMapping("/overseaPackageList")
@Api(tags = "海外仓收货任务", description = "海外仓收货任务")
public class OverseaPackageListController {

    /**
    @Autowired
    IOverseaPackageListService iOverseaPackageListService;

    @RequestMapping("/getOverseaPlList")
    @ApiOperation(value = "获取收货任务表头分页", notes = "获取收货任务分页\n" +
            "示例参数：\n" +
            "{\n" +
            "\t\"autoIdPackageList\": 0,\n" +
            "\t\"cabinetNumber\": \"\",\n" +
            "\t\"current\": 1,\n" +
            "\t\"sapDeliveryNote\": \"\",\n" +
            "\t\"sapPackageList\": \"\",\n" +
            "\t\"size\": 20,\n" +
            "\t\"spmsId\": \"\",\n" +
            "\t\"spmsStatus\": \"\",\n" +
            "\t\"uuidPackageList\": \"\",\n" +
            "\t\"werksDelivery\": \"\",\n" +
            "\t\"werksReceive\": \"\"\n" +
            "}", httpMethod = "POST")
    public ResponseResult getOverseaPlList(@RequestBody OverseaPackageListQueryDTO overseaPackageListQueryDTO){
        try {
            return ResponseResult.success().add("overseaPackageLists", iOverseaPackageListService.getOverseaPackageListIPage(overseaPackageListQueryDTO));
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/getOverseaPackageList")
    @ApiOperation(value = "根据收货任务UUID查询一个任务表头", notes = "根据海外仓收货任务uuid查询一条任务信息\n" +
            "示例：uuidPackageList = b33ad5b49219425a942334afe48d2a09, 50ef7515ca2341d39ca1d86cdef16b16\n",
            httpMethod = "POST")
    public ResponseResult getOverseaPackageList(@RequestParam String uuidPackageList){
        try {
            return ResponseResult.success().add("overseaPackageList", iOverseaPackageListService.getOverseaPackageList(uuidPackageList));
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/getOverseaPackageListItem")
    @ApiOperation(value = "搜索收货任务行项目", notes = "根据收货任务行项目\n" +
            "sapPackageList = SPL10000001，sapDeliveryNote = 2000000002，" +
            "cabinetNumber = TGBU5570002，三个查询条件不能都为空；\n" +
            "queryType：查询方式，默认1按箱码，2按物料查询\n" +
            "{\n" +
            "\t\"cabinetNumber\": \"\",\n" +
            "\t\"queryType\": \"1\",\n" +
            "\t\"sapDeliveryNote\": \"2000000001\",\n" +
            "\t\"sapPackageList\": \"SPL10000001\"\n" +
            "}",
            httpMethod = "POST")
    public ResponseResult getOverseaPackageListItem(OverseaPackageListItemQueryDTO overseaPackageListItemQueryDTO){
        try {
            return ResponseResult.success().add("overseaPackageListItem", iOverseaPackageListService.getOverseaPackageListItem(overseaPackageListItemQueryDTO));
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/getOverseaDnOverOrUnderCharged")
    @ApiOperation(value = "获取交货单实际收货信息(含损益)", notes = "获取交货单实际收货信息(含损益)\n" +
            "sapDeliveryNote = 2000000001, 2000000002",
            httpMethod = "POST")
    public ResponseResult getOverseaDnOverOrUnderCharged(@RequestParam String sapDeliveryNote){
        try {
            return ResponseResult.success().add("overseaPackageListItem", iOverseaPackageListService.getOverseaDnOverOrUnderCharged(sapDeliveryNote));
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/overseaPackageListToSap")
    @ApiOperation(value = "交货单提交SAP(含损益)", notes = "交货单提交SAP(含损益)\n" +
            "sapDeliveryNote = 2000000001, 2000000002",
            httpMethod = "POST")
    public ResponseResult overseaPackageListToSap(@RequestBody OverseaPackageListDtlDTO overseaPackageListDtlDTO){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaPackageListService.overseaPackageListToSap(overseaPackageListDtlDTO, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/cancelOverseaPackageList")
    @ApiOperation(value = "交货单撤销提交SAP", notes = "交货单撤销提交SAP\n" +
            "sapDeliveryNote = 2000000001, cancelPostingDate = 2021-10-18\n" +
            "SAP返回成功则交货单状态由完成(提交SAP成功)更新为收货中，SAP返回失败则忽略所有更新，只记录日志；",
            httpMethod = "POST")
    public ResponseResult cancelOverseaPackageList(@RequestParam String sapDeliveryNote, @RequestParam String cancelPostingDate ){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaPackageListService.cancelOverseaPackageList(sapDeliveryNote, cancelPostingDate, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }
    **/

}
